import React from 'react'
import { CloseOutlined } from '@ant-design/icons'
import css from './dialog.less'
import { Button } from 'antd'
export interface DialogProps {
  open?: boolean
  children?: JSX.Element | JSX.Element[]
  onOk?: () => void
  onClose?: () => void
}
export default function (props: DialogProps) {
  return (
    <div className={`${css['box']} ${props.open ? css['open'] : ''}`}>
      <div className={css['header']}>
        <div className={css['title']}>对话框</div>
        <div className={css['close']} onClick={props.onClose}>
          <CloseOutlined />
        </div>
      </div>
      <div className={css['content']}>{props.open ? props.children : null}</div>
      <div className={css['footer']}>
        <Button type="default" onClick={props.onClose}>
          取消
        </Button>
        <Button type="primary" onClick={props.onOk}>
          确定
        </Button>
      </div>
    </div>
  )
}
